package com.yuan.goods;

import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import com.yuan.common.xml.XMITransform;

@XmlRootElement(name = "products")
public class GoodsContainer {

	List<Goods> goods;

	@XmlElement(name = "product")
	public List<Goods> getGoods() {
		return goods;
	}

	public void setGoods(List<Goods> goods) {
		this.goods = goods;
	}

	public void toXml(String filePath) {
		XMITransform.toFile(filePath, "UTF-8", GoodsContainer.class, this);
	}

	public static GoodsContainer fromXml(String filePath) {
		return (GoodsContainer) XMITransform.loadFile(filePath, GoodsContainer.class);
	}

}
